package argo.hot100.mqtrix;

public class SearchMatrix {


    public boolean searchMatrix(int[][] matrix, int target) {

        int x = 0, y = matrix[0].length - 1;

        while (x < matrix.length && y >= 0) {

            if (matrix[x][y] == target) {
                return true;
            }

            if (matrix[x][y] > target) {
                y--;
            } else {
                x++;
            }


        }

        return false;
    }


}
